<?php // no direct access
defined('_JEXEC') or die('Restricted access'); 
switch($paramID)
{
    case 0: //trang chu
        {   
            $listSection = modListBookHelper::getList();
            foreach($listSection as $sectionID) 
            {
                $section = modListBookHelper::getSecTion($sectionID );
                $listbook = modListBookHelper::getListBook($sectionID);
				$countRow = count($listbook);
                $index = 1;
                ?>
                <div class="titleLinhVuc"><?php echo $section; ?></div>
				<?php if($countRow > 0) {?>
                <table class="listBook">
                    <tr>
                    <?php foreach($listbook as $book) { ?> 
                		<td><a href="index.php?option=com_content&view=article&id=11&masach=<?php echo $book['0'] ?>&luotxem=<?php echo $book['10'] ?>" title="<?php echo $book['2']; ?>" ><img src="<?php echo $book['3']; ?>" /></a></td>
                        <?php if($index%7 == 0) { ?>
                        </tr>
                        </table>
						<?php if($index == $countRow) break; ?> <!--truong hop index bang so dong lay ra thi thoat khoi switch-->
                        <table class="listBook">
                        <tr>
                        <?php } 
                        $index++;
                        ?>
                    <?php }?>
                    </tr>
                </table>
                <?php
				}
            }
            break;
        }
    case 1: //menu cha
    case 2:
    case 3:
    case 4:
    case 5:
    {
        if($ma_linhvuc_con == 0)//truong hop la menu cha
        {
            $section = modListBookHelper::getSecTion($paramID );
            $listbook = modListBookHelper::getListBook($paramID);
			$countRow = count($listbook);
            $index = 1;
            ?>
            <div class="titleLinhVuc"><?php echo $section; ?></div>
			<?php if($countRow > 0) {?>
            <table class="listBook">
                <tr>
                <?php foreach($listbook as $book) { ?> 
            		<td><a href="index.php?option=com_content&view=article&id=11&masach=<?php echo $book['0'] ?>&luotxem=<?php echo $book['10'] ?>" title="<?php echo $book['2']; ?>" ><img src="<?php echo $book['3']; ?>" /></a></td>
                    <?php if($index%7 == 0) { ?>
                    </tr>
                    </table>
					<?php if($index == $countRow) break; ?> <!--truong hop index bang so dong lay ra thi thoat khoi switch-->
                    <table class="listBook">
                    <tr>
                    <?php } 
                    $index++;
                    ?>
                <?php }	?>
                </tr>
            </table>
            <?php
			}
        }
        else//truong hop la menu con
        {
            $tenLinhVucCon = modListBookHelper::getNameChildField($ma_linhvuc_con);
            $listbook = modListBookHelper::getListBookInField($ma_linhvuc_con);
			$countRow = count($listbook);
            $index = 1;
            ?>
            <div class="titleLinhVuc"><?php echo $tenLinhVucCon; ?></div>
			<?php if($countRow > 0) {?>
            <table class="listBook">
                <tr>
                <?php foreach($listbook as $book) { ?> 
            		<td><a href="index.php?option=com_content&view=article&id=11&masach=<?php echo $book['0'] ?>&luotxem=<?php echo $book['10'] ?>" title="<?php echo $book['2']; ?>"><img src="<?php echo $book['3']; ?>" /></a></td>
                    <?php if($index%7 == 0) { ?>
                    </tr>
                    </table>
					<?php if($index == $countRow) break; ?> <!--truong hop index bang so dong lay ra thi thoat khoi switch-->
                    <table class="listBook">
                    <tr>
                    <?php } 
                    $index++;
                    ?>
                <?php } ?>
                </tr>
            </table>
            <?php
			}
        }
        break;
    }
    default:
    { 
        break;
    }
}
?>

